<?php
class cgtypeClassAction extends Action
{
	public function addAction(){
		$pid = $this->post("pid") == "" ? 0 : $this->post("pid");	
		$name = $this->post("name");
		if ($name == "") {
			return '分类名称不能为空';
		}
		$arr = array(
			"pid"=>$pid,
			"name"=>$name
		);
		m("cgtype")->insert($arr);
		return "ok";
	}
	public function delAction(){
		$id = $this->post("id");
		m("cgtype")->delete("id=".$id);
		return "ok";
	}
	public function showAction(){
		
	}
	
	public function getlistAjax(){
		echo "123123";exit();
//		$pid = $this->post("pid") == "" ? 0 : $this->post("pid");
//		$rows = m("cgtype")->getrows("pid=".$pid, "*");
//		echo json_encode($rows);
	}
}